home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Mesa-2.2 / include / gltk.h < prev   
Encoding:
C/C++ Source or Header  |  1997-02-03  |  6.4 KB  |  307 lines

  1. /* $Id: gltk.h,v 1.3 1997/02/03 20:08:13 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  2.1
  6.  * Copyright (C) 1995-1996  Brian Paul
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * This code originated from SGI and was modified for use with Mesa.
  26.  */
  27.  
  28.  
  29. #ifndef GLTK_INCLUDED
  30. #define GLTK_INCLUDED
  31.  
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37.  
  38. #ifdef __BEOS__
  39. #include "GL/gl.h"
  40. #include "GL/glu.h"
  41. #else
  42. #include <GL/gl.h>
  43. #include <GL/glu.h>
  44. #endif
  45.  
  46.  
  47. /*
  48. ** Nano Window Toolkit.
  49. ** Version 1.1
  50. */
  51.  
  52.  
  53. #if defined(__WIN32__) || defined(DOSVGA)
  54. /*
  55. ** Display Mode Selection Criteria
  56. */
  57. enum {
  58.     TK_USE_ID = 1,
  59.     TK_EXACT_MATCH,
  60.     TK_MINIMUM_CRITERIA
  61. };
  62. #endif
  63.  
  64.  
  65. /*
  66. ** Window Types
  67. */
  68.  
  69. #define TK_RGB        0
  70. #define TK_INDEX    1
  71. #define TK_SINGLE    0
  72. #define TK_DOUBLE    2
  73. #define TK_DIRECT    0
  74. #define TK_INDIRECT    4
  75. #define TK_ACCUM    8
  76. #define TK_ALPHA    16
  77. #define TK_DEPTH    32
  78. #define TK_STENCIL    64
  79. #define TK_OVERLAY    128
  80. #define TK_UNDERLAY    256
  81.  
  82. /* 
  83. ** Window Masks
  84. */
  85.  
  86. #define TK_IS_RGB(x)        (((x) & TK_INDEX) == 0)
  87. #define TK_IS_INDEX(x)        (((x) & TK_INDEX) != 0)
  88. #define TK_IS_SINGLE(x)        (((x) & TK_DOUBLE) == 0)
  89. #define TK_IS_DOUBLE(x)        (((x) & TK_DOUBLE) != 0)
  90. #define TK_IS_DIRECT(x)        (((x) & TK_INDIRECT) == 0)
  91. #define TK_IS_INDIRECT(x)    (((x) & TK_INDIRECT) != 0)
  92. #define TK_HAS_ACCUM(x)        (((x) & TK_ACCUM) != 0)
  93. #define TK_HAS_ALPHA(x)        (((x) & TK_ALPHA) != 0)
  94. #define TK_HAS_DEPTH(x)        (((x) & TK_DEPTH) != 0)
  95. #define TK_HAS_OVERLAY(x)    (((x) & TK_OVERLAY) != 0)
  96. #define TK_HAS_UNDERLAY(x)    (((x) & TK_UNDERLAY) != 0)
  97. #define TK_HAS_STENCIL(x)    (((x) & TK_STENCIL) != 0)
  98.  
  99. /*
  100. ** Windowing System Specific Gets
  101. */
  102.  
  103. typedef enum {
  104.     TK_X_DISPLAY = 1,
  105.     TK_X_WINDOW
  106. } TKenum;
  107.  
  108. /*
  109. ** Event Status
  110. */
  111.  
  112. #define    TK_LEFTBUTTON        1
  113. #define    TK_RIGHTBUTTON        2
  114. #define    TK_MIDDLEBUTTON        4
  115. #define    TK_SHIFT        1
  116. #define    TK_CONTROL        2
  117.  
  118. /* 
  119. ** Key Codes
  120. */
  121.  
  122. #define TK_RETURN        0x0D
  123. #define TK_ESCAPE        0x1B
  124. #define TK_SPACE        0x20
  125. #define TK_LEFT            0x25
  126. #define TK_UP            0x26
  127. #define TK_RIGHT        0x27
  128. #define TK_DOWN            0x28
  129. #define TK_A            'A'
  130. #define TK_B            'B'
  131. #define TK_C            'C'
  132. #define TK_D            'D'
  133. #define TK_E            'E'
  134. #define TK_F            'F'
  135. #define TK_G            'G'
  136. #define TK_H            'H'
  137. #define TK_I            'I'
  138. #define TK_J            'J'
  139. #define TK_K            'K'
  140. #define TK_L            'L'
  141. #define TK_M            'M'
  142. #define TK_N            'N'
  143. #define TK_O            'O'
  144. #define TK_P            'P'
  145. #define TK_Q            'Q'
  146. #define TK_R            'R'
  147. #define TK_S            'S'
  148. #define TK_T            'T'
  149. #define TK_U            'U'
  150. #define TK_V            'V'
  151. #define TK_W            'W'
  152. #define TK_X            'X'
  153. #define TK_Y            'Y'
  154. #define TK_Z            'Z'
  155. #define TK_a            'a'
  156. #define TK_b            'b'
  157. #define TK_c            'c'
  158. #define TK_d            'd'
  159. #define TK_e            'e'
  160. #define TK_f            'f'
  161. #define TK_g            'g'
  162. #define TK_h            'h'
  163. #define TK_i            'i'
  164. #define TK_j            'j'
  165. #define TK_k            'k'
  166. #define TK_l            'l'
  167. #define TK_m            'm'
  168. #define TK_n            'n'
  169. #define TK_o            'o'
  170. #define TK_p            'p'
  171. #define TK_q            'q'
  172. #define TK_r            'r'
  173. #define TK_s            's'
  174. #define TK_t            't'
  175. #define TK_u            'u'
  176. #define TK_v            'v'
  177. #define TK_w            'w'
  178. #define TK_x            'x'
  179. #define TK_y            'y'
  180. #define TK_z            'z'
  181. #define TK_0            '0'
  182. #define TK_1            '1'
  183. #define TK_2            '2'
  184. #define TK_3            '3'
  185. #define TK_4            '4'
  186. #define TK_5            '5'
  187. #define TK_6            '6'
  188. #define TK_7            '7'
  189. #define TK_8            '8'
  190. #define TK_9            '9'
  191.  
  192. /*
  193. ** Color Macros
  194. */
  195.  
  196. enum {
  197.     TK_BLACK = 0,
  198. #ifdef __WIN32__
  199.     TK_RED=10,
  200. #else
  201.     TK_RED,
  202. #endif
  203.     TK_GREEN,
  204.     TK_YELLOW,
  205.     TK_BLUE,
  206.     TK_MAGENTA,
  207.     TK_CYAN,
  208.     TK_WHITE
  209. };
  210.  
  211. #ifdef __BEOS__
  212. #pragma export on
  213. #endif
  214.  
  215. #if defined(__WIN32__) || defined(DOSVGA)
  216. extern float tkRGBMap[17][3];
  217. #else
  218. extern float tkRGBMap[8][3];
  219. #endif
  220.  
  221. #define TK_SETCOLOR(x, y) (TK_IS_RGB((x)) ? \
  222.                    glColor3fv(tkRGBMap[(y)]) : glIndexf((y)))
  223.  
  224. /*
  225. ** RGB Image Structure
  226. */
  227.  
  228. typedef struct _TK_RGBImageRec {
  229.     GLint sizeX, sizeY;
  230.     unsigned char *data;
  231. } TK_RGBImageRec;
  232.  
  233. /*
  234. ** Prototypes
  235. */
  236.  
  237. extern void tkInitDisplayMode(GLenum);
  238. extern void tkInitPosition(int, int, int, int);
  239. extern GLenum tkInitWindow(char *);
  240. extern void tkCloseWindow(void);
  241. extern void tkQuit(void);
  242.  
  243. extern GLenum tkSetWindowLevel(GLenum);
  244. extern void tkSwapBuffers(void);
  245.  
  246. extern void tkExec(void);
  247. extern void tkExposeFunc(void (*)(int, int));
  248. extern void tkReshapeFunc(void (*)(int, int));
  249. extern void tkDisplayFunc(void (*)(void));
  250. extern void tkKeyDownFunc(GLenum (*)(int, GLenum));
  251. extern void tkMouseDownFunc(GLenum (*)(int, int, GLenum));
  252. extern void tkMouseUpFunc(GLenum (*)(int, int, GLenum));
  253. extern void tkMouseMoveFunc(GLenum (*)(int, int, GLenum));
  254. extern void tkIdleFunc(void (*)(void));
  255.  
  256. extern int tkGetColorMapSize(void);
  257. extern void tkGetMouseLoc(int *, int *);
  258. extern void tkGetSystem(TKenum, void *);
  259.  
  260. extern void tkSetOneColor(int, float, float, float);
  261. extern void tkSetFogRamp(int, int);
  262. extern void tkSetGreyRamp(void);
  263. extern void tkSetRGBMap(int, float *);
  264. extern void tkSetOverlayMap(int, float *);
  265.  
  266. extern void tkNewCursor(GLint, GLubyte *, GLubyte *, GLenum, GLenum,
  267.             GLint, GLint);
  268. extern void tkSetCursor(GLint);
  269.  
  270. extern TK_RGBImageRec *tkRGBImageLoad(char *);
  271.  
  272. extern GLenum tkCreateStrokeFont(GLuint);
  273. extern GLenum tkCreateOutlineFont(GLuint);
  274. extern GLenum tkCreateFilledFont(GLuint);
  275. extern GLenum tkCreateBitmapFont(GLuint);
  276. extern void tkDrawStr(GLuint, char *);
  277.  
  278. extern void tkWireSphere(GLuint, float);
  279. extern void tkSolidSphere(GLuint, float);
  280. extern void tkWireCube(GLuint, float);
  281. extern void tkSolidCube(GLuint, float);
  282. extern void tkWireBox(GLuint, float, float, float);
  283. extern void tkSolidBox(GLuint, float, float, float);
  284. extern void tkWireTorus(GLuint, float, float);
  285. extern void tkSolidTorus(GLuint, float, float);
  286. extern void tkWireCylinder(GLuint, float, float);
  287. extern void tkSolidCylinder(GLuint, float, float);
  288. extern void tkWireCone(GLuint, float, float);
  289. extern void tkSolidCone(GLuint, float, float);
  290.  
  291. #ifdef __BEOS__
  292. #pragma export off
  293. #endif
  294.  
  295. #ifdef __cplusplus
  296. }
  297. #endif
  298.  
  299.  
  300. #ifdef __WIN32__
  301. #include <windows.h>
  302. HWND tkGetHWND(void);
  303. #endif /* WIN32 */
  304.  
  305.  
  306. #endif
  307.